package GameSet;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;

import Food.Food;
import Snake.Snake;

public class SnakePanel extends JPanel{
	Snake snake;
	public SnakePanel(Snake snake){
		this.snake = snake;
	}
	
	public void paintComponent(Graphics g){
		super.paintComponents(g);
		Food food = null;
		for (int i = 0; i < snake.body.size(); i++) {
			g.setColor(Color.black);
			food = snake.body.get(i);
			g.fillRect(food.x, food.y, food.H, food.W);
		}
		food = snake.food;
		g.setColor(Color.RED);
		g.fillRect(food.x, food.y, food.H, food.W);
		
	}
}
